define(['jquery', 'angular', 'app.services', 'require'],function($, angular, services,  require){
    'use strict';

    services.service('curuserService', ['$resource','Base','$q',function ($resource,Base,$q) {


        //获取当前用户信息
        this.getCurUserInfo = function (success,error) {
            return $resource(Base.stringFormat("/cu", Base.dataApiUri.student)).get(success,error);
        };
        //获取当前用户详细信息
        this.getDetailedCurUserInfo = function (userId,success,error) {
            return $resource(Base.stringFormat("/cu/detailed/:userId", Base.dataApiUri.student),{userId:userId}).get(success,error);
        };
        //登录
        this.login = function (username,password,ref,success,error) {
            return $resource(Base.stringFormat("/login/:username/:password?ref=:ref", Base.dataApiUri.student),{username:username,password:password,ref:ref}).get(success,error);
        };

        //判断用户名手机号
        this.justPhoneAndName=function(username,phone,success,error){
            return $resource(Base.stringFormat("/dapi/muser/justPhoneAndName/:username/:phone",'dapi'),{username:username,phone:phone}).get(success,error);
        };
        this.changePwd=function(username,phone,password,success,error){
            return $resource(Base.stringFormat("/dapi/muser/changePwd/:username/:phone/:password",'dapi'),{username:username,phone:phone,password:password}).get(success,error);
        };

        //获取验证码
        this.getYZM = function (phone,success,error) {
            return $resource(Base.stringFormat("/dapi/phone/sendYZM/:phone",'dapi'),{phone:phone}).get(success,error);
        };
        //注册
        this.registerUser = function (userInfo,success,error) {
            return $resource(Base.stringFormat("/dapi/muser/register")).save(userInfo,success,error);
        };
        //注册修改
        this.registerUserUpdate = function (userInfo,success,error) {
            return $resource(Base.stringFormat("/dapi/muser/registerUpdate")).save(userInfo,success,error);
        };
        //通过注册吗获取用户信息
        this.getUserInfoByRegCode = function (regInfo,success,error) {
            return $resource(Base.stringFormat("/dapi/muser/getUserByReg")).save(regInfo,success,error);
        };
        //协议内容
        this.getXy = function(xyType, success, error){
            return $resource("/dapi/magreement/getXy/"+xyType).get( success, error);
        };
    }]);


});

